package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.QuestionFormDTO;
import com.tianji.learning.domain.query.QuestionAdminPageQuery;
import com.tianji.learning.domain.query.QuestionPageQuery;
import com.tianji.learning.domain.vo.QuestionAdminVO;
import com.tianji.learning.domain.vo.QuestionVO;
import com.tianji.learning.service.IInteractionQuestionService;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 互动提问的问题表 -管理端- 前端控制器
 * </p>
 *
 * @author xie
 * @since 2024-11-12
 */
@RestController
@RequestMapping("admin/questions")
@RequiredArgsConstructor
public class InteractionQuestionAdminController {

    private final IInteractionQuestionService iInteractionQuestionService;

    /**
     * 1、分页查询互动问题（Day5 - 课堂2）
     * @param query
     */
    @GetMapping("/page")
    public PageDTO<QuestionAdminVO> pageQuery(QuestionAdminPageQuery query){
        return iInteractionQuestionService.adminPageQuery(query);
    }



    /**
     * 管理端根据id查询互动问题 （Day5 - 实战3）
     *
     * @param id
     */
    @ApiOperation("管理端根据id查询互动问题")
    @GetMapping("{id}")
    public QuestionAdminVO queryQuestionByIdAdmin(@PathVariable("id") Long id) {
        return iInteractionQuestionService.queryQuestionByIdAdmin(id);
    }

    /**
     * 隐藏或显示问题 （Day5 - 实战4）
     *
     * @param id
     * @param hidden
     */
    @ApiOperation("隐藏或显示问题")
    @PutMapping("/{id}/hidden/{hidden}")
    public void hiddenQuestion(
            @ApiParam(value = "问题id", example = "1") @PathVariable("id") Long id,
            @ApiParam(value = "是否隐藏，true/false", example = "true") @PathVariable("hidden") Boolean hidden
    ) {
        iInteractionQuestionService.hiddenQuestion(id, hidden);
    }



}















